﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace OnlineScheduling.DomainModel
{
    public abstract class Solver
    {
        
        public Solver(Instance instance)
        {
            Instance = instance;
            WeightedSum = -1;
            processors = new List<Processor>();
            idListOfFreeCPUs = new List<int>();

            for (int i = 0; i < Instance.NumberOfCPUs; i++)
            {
                processors.Add(new Processor(i, ProcessorsPriorityType.ByEarliestFinish));
                idListOfFreeCPUs.Add(i);
            }

        }

        public Instance Instance { get; protected set; }   //tu kopiec posortowany według przybycia
        public int WeightedSum { get; protected set; }
        protected List<Processor> processors;
        protected List<int> idListOfFreeCPUs;

        public bool IsDone
        {
            get
            {
                return WeightedSum != -1;
            }
        }

        protected Heap<Processor> currentyWorkingCPUs;
        protected Heap<Task> receivedTasksByPrioritySorted;


        public abstract int Run();
        
    }
}
